package com.email.controller;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.email.entity.Message;
import com.email.entity.MessagePushFactory;

@RestController
public class SendController {
	
	@RequestMapping("/send")
	public String sendTest(@RequestBody Message message) throws Exception{
		String result = MessagePushFactory.getService(message.getType()).send(message);
		return result;
	}

	
	/*
	
	http://localhost:8086/send
{
	"userId":"1511489938@qq.com",
	"type":"email",
	"body":{
	"subject":"Subject",
	"url":"ll",
	"content":"This is a email...",
	"connInfo":{
		"port":"25",
		"host":"smtp.163.com",
		"username":"17621686131@163.com",
		"passwd":"qq1099987516",
		"protocol":"smtp"
	
	}
	}
}
	
	*/
}
